import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from "@dfeidao/atom-web/msg/nodejs";
// import whoami from '@dfeidao/atom-web/msg/whoami';
// import { send_msg as url, get_user_info } from './config';

import get from '@dfeidao/atom-web/local/get';
import remove from '@dfeidao/atom-web/local/remove';
import error from '@dfeidao/atom-web/msgbox/error';
import success from '@dfeidao/atom-web/msgbox/success';
import s_get from '@dfeidao/atom-web/storage/get';



export default async function a010(fd: IFeidaoAiBrowserComponent, args: { target: HTMLElement }) {
	// 删除
	// const user = await whoami(get_user_info);
	// console.log(user)
	const prid = await s_get('productid');

	const id = get(fd, 'w_id');
	const uscode = args.target.dataset.feidaoName;
	if (!id) {
		error('请选择一条删除数据');
		return;
	} else {
		const del_res = await nodejs('consumer/zj-000004/consumer-del1', { id, productid: prid });
		if (del_res === 'success') {
			success('删除成功');
			remove(fd, 'w_id');
			fire('zj-000004', 'ec-002', uscode);
		} else {
			error('删除失败');
		}
	}
}
